<?php
class Sales {
	
	public static function get_sales_representatives($name){
		$ret = array();
		if($name != ""){
			$drupal = DRUPAL_DB_NAME;
			// TODO complete this
		}
		
		return $ret;
	}
	
	public static function add_sales_representative($uid,$fullname){
		if($uid == "" || $fullname == ""){
			watchdog("sales","Invalid arguments.",array(),WATCHDOG_ERROR);
		} else {
			if(db_set_active(ACCTG_DB_NAME)){
				$sql = "insert into {sales_representatives} (uid,full_name) values (%d,'%s')";
				if(db_query($sql,$uid,$fullname) === FALSE){
					db_set_active();
					watchdog("sales","Unable to add sales representative: uid %uid, full name %fullname",
						array("%uid"=>$uid,"%fullname"=>$full_name));
				}
				
				db_set_active();
			} else {
				db_set_active();
				watchdog("sales","Unable to connect to accounting database.",array(),WATCHDOG_ERROR);
			}
		}
	}
}